#version 450
layout(binding = 1) uniform sampler2D texSamplerY;
layout(binding = 2) uniform sampler2D texSamplerU;
layout(binding = 3) uniform sampler2D texSamplerV;

layout(location = 0) in vec2 fragTexCoord;

layout(location = 0) out vec4 outColor;

const mat3 yuv2rgb = mat3(
    1.164,  1.164, 1.164,
    0.0,   -0.391, 2.018,
    1.596, -0.813, 0.0);

void main() 
{
    float y = texture(texSamplerY, fragTexCoord).r;
    float u = texture(texSamplerU, fragTexCoord).r;
    float v = texture(texSamplerV, fragTexCoord).r;

    vec3 color = yuv2rgb * vec3(y, u - 0.5, v - 0.5) - vec3(0.073);

    outColor.rgb = color;
    outColor.a = 1.0;
 
//    outColor = vec4(fragTexCoord, 0.0, 1.0) * vec4(fragColor, 1.0);
    
    // outColor = texture(texSampler, fragTexCoord);
	// outColor = vec4(fragColor * texture(texSampler, fragTexCoord).rgb, 1.0);
}